﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VietThinks.Model;

namespace VietThinks.Mapping.Maps
{
    public class AccountMap : DomainEntityMap<Account>
    {
        public AccountMap()
        {
            Schema("Account");
            Table("Account");
            Map(m => m.UserName).Unique().Not.Nullable();
            Map(m => m.Password).Not.Nullable();
            Map(m => m.Actived);
            References(m => m.Role, "RoleId");
            HasMany(m => m.RightDenieds)
               .KeyColumn("AccountId")
               .Inverse()
               .Cascade.AllDeleteOrphan()
              ;
            Map(m => m.IsLogin);
            Map(m => m.LastLoginDate);
            Map(m => m.LastLogoutDate);
        }
    }
}
